package com.xdxc.utils;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;
import java.util.List;

public class LongListToStringSerializer extends JsonSerializer<List<Long>> {
    @Override
    public void serialize(List<Long> value, JsonGenerator gen, SerializerProvider provider)
            throws IOException {
        gen.writeStartArray();
        for (Long num : value) {
            gen.writeString(num.toString()); // 逐个序列化为字符串
        }
        gen.writeEndArray();
    }
}
